#include "rpc.srpc.h"
#include "workflow/WFFacilities.h"
#include <iostream>
using std::cout;
using namespace srpc;

static WFFacilities::WaitGroup wait_group(1);

void sig_handler(int signo)
{
	wait_group.done();
}

static void signup_done(RespSignup *response, srpc::RPCContext *context){
	cout << "code = " << response->code() << "\n";
	cout << "messsage = " << response->message() << "\n";
}
int main()
{
	GOOGLE_PROTOBUF_VERIFY_VERSION;
	const char *ip = "127.0.0.1";
	unsigned short port = 1412;

	UserService::SRPCClient client(ip, port);

	// example for RPC method call
	ReqSignup signup_req;
	//signup_req.set_message("Hello, srpc!");
	signup_req.set_usename("admin");
	signup_req.set_password("123");
	client.Signup(&signup_req, signup_done);
	wait_group.wait();
	google::protobuf::ShutdownProtobufLibrary();
	return 0;
}
